import { FilterDTO } from "@/api/interface/index";

import http from "@/api";

export const userView = (id: string) => {
	return http.get<User.UserDTO>(`/user/view/` + id);
};
export const userDelete = (id: string) => {
	return http.delete<User.UserDTO>(`/user/` + id);
};

export const userList = (params: FilterDTO) => {
	return http.post<User.UserDTO[]>(`/user/list`, params);
};
export const userSave = (params: User.UserDTO) => {
	return http.post<User.UserDTO>(`/user/save`, params);
};
export const userPassReset = (id: string) => {
	return http.post<User.PassResetResDTO>(`/user/passReset/` + id);
};

// 用户
export namespace User {
	export interface UserDTO {
		username: string;
		password: string;
		userId: string;
		name: string;
		phone: string;
		email: string;
		isSys: boolean;
		roleIds: string[];
	}
	export interface PassResetResDTO {
		username: string;
		password: string;
		userId: string;
		name: string;
	}
}
